// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import './config/iview-config'
import store from './store'
import login from './store/modules/login'

Vue.config.productionTip = false
/* eslint-disable no-new */

router.beforeEach ((to, from , next) => {
  if (to.name === 'Login') {
    next()
  } else {
    if (store.state.login.isLogin) {
      next()
    } else {
      next('/login')
    }
  }
})
new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: '<App/>'
})
